home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
011
/
nosnow.arc
/
NOSNOW.DOC
next >
Wrap
Text File
|
1985-08-28
|
3KB
|
94 lines
The snow on a color graphics adapter occurrs when you change the values
in screen memory during a raster scan, i.e. while the electron gun is
updating the screen from screen memory. I'm not sure of the exact mechanism,
but this definitely causes interference with the screen update, and the
end result is that ugly snow.
One way to avoid this is to wait for "vertical retrace", that time period
during which the electron gun shifts its beam from the lower right-hand
corner of the screen to the upper left. During vertical retrace, bit 3
of port 3DA (hex) is set on, and the test in TURBO can thus be made:
Repeat until ((port[$3DA] and $08) = $08);
{*** perform screen update ***}
{*** note: port $3DA is a read-only register ***}
This is how the IBM ROM-BIOS writes a character to the screen, does
scrolling, etc. But the problem is that vertical retrace lasts a mere
1.25 miliseconds or so, not enough time to perform complicated and/or
large updates.
The other way, the way Sidekick does it, is to turn off the display, do the
update, and turn the display back on. This is why, when you bring up a
Sidekick window, you see a momentary "flash" on the screen. The display
enable/disable function is controlled by port 3D8 (hex), a write-only
register.
One thing you should know about this is that this whole concept applies only
to the IBM color graphics adapter. Monochrome displays do not get snow,
and the Enhanced graphics adapter will crap out on you if you turn off the
display in this way. This is why earlier versions of Sidekick bombed on the
Enhanced graphics adapter. Current versions of Sidekick work just fine on
the EGA.
Use the following, or a similar routine to test what kind of display you
are running on, and then to update the screen:
type
Registertype = Record
case boolean of
true : (AX,BX,CX,DX,BP,SI,DI,DS,ES,flags : integer);
false : (AL,AH,BL,BH,CL,CH,DL,DH : byte)
end;
video_mode_ptr = ^video_mode_type;
video_mode_type = (cga,ega,mono);
function get_video_mode : video_mode_ptr;
var
regs : registertype;
equipment : integer;
ega_info1,
ega_info2 : byte;
temp_return : video_mode_ptr;
begin
intr($11,regs);
equipment := regs.AX;
regs.AH := $12;
regs.BL := $10;
intr($10,regs);
ega_info1 := regs.CL;
ega_info2 := regs.BH;
new(temp_return);
if ((equipment and 52) in [0,16,32]) and (ega_info2=0)
then
temp_return^ := ega
else
if ((equipment and 48) in [16,32])
or (((equipment and 52) = 4) and (ega_info1 in [4,5,10,11]))
then
temp_return^ := cga
else
temp_return^ := mono;
get_video_mode := temp_return
end;
begin {* screen update *}
video_mode := get_video_mode;
if video_mode^<>mono
then
if video_mode^=cga
then
begin
port[$3D8] := $21;
{*** perform screen updates ***}
port[$3D8] := $29
end
else
saved_screen := cscr
else
saved_screen := mscr
end; {* screen update*}
There seems to be a bit of controversy as to whether the "snow" or the
"flash" is more ascetically displeasing, but I prefer the "flash".
Please upload some applications of this.